#@layout()

#define script()
<script>
    function doDel(id) {
        if (confirm("确认删除吗？删除后不可恢复")){
            ajaxGet("/admin/form/datasource/doDel/" + id);
        }
    }
</script>
#end

#define content()

<section class="content-header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">

                <div class="row mb-2">
                    <div class="col-sm-12">
                        <h1>
                            数据源
                            <small data-toggle="tooltip" title="" data-placement="right"
                                   data-trigger="hover"><i class="nav-icon far fa-question-circle"></i></small>
                            <small> 首页 / 表单 / 数据源</small>
                        </h1>
                    </div>
                </div>
            </div>

            <div class="col-sm-6 ">
                <div class=" float-sm-right" style="padding-top: 15px">
                    <a href="edit" type="button" class="btn btn-primary"><i class="fas fa-plus"></i>新建</a>
                </div>
            </div>

        </div>
    </div>
</section>

<section class="content">

    <div class="row">
        <div class="col-12">
            <div class="card card-outline card-primary">
                <div class="card-header with-border">
                    <form class=" admin-search-panel" action="#(CPATH)/admin/form/datasource/list" method="get">
                        <div class="row">

                            <div class="form-group col-lg-2">
                                <input type="text" class="form-control" placeholder="请输入名称" name="name" value="#para('name')">
                            </div>

                            <div class="form-group col-lg-2">
                                <button type="submit" class="btn btn-primary ">查询</button>
                                <button type="reset" class="btn btn-default">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <!-- /.card-header -->
                <div class="card-body p-0">

                    <table class="table table-striped">
                        <tbody>
                        <tr>
                            <th style="width: 10px">
                                <input class="tableCheckAll" type="checkbox"/>
                            </th>
                            <th style="width: 260px">数据源名称</th>
                            <th>内容类型</th>
                            <th>创建时间</th>
                            <th>修改时间</th>

                        </tr>
                        #for(entry : page.list)
                        <tr>
                            <td><input name="tableItem" type="checkbox" value="#(entry.id)" /></td>

                            <td style="width: 200px">
                            #(entry.name)
                                <div class="jp-action-card">
                                    <div class="jp-action-body">
                                        <a href="#(CPATH)/admin/form/datasource/item/#(entry.id ??)">数据管理</a> |
                                        <a href="#(CPATH)/admin/form/datasource/edit/#(entry.id ??)">编辑</a> |
                                        <a href="javascript:;" class="red-action"
                                           onclick="doDel('#(entry.id)')">删除</a>
                                    </div>
                                </div>
                            </td>


                            <td>
                                #if(entry.with_static ??)
                                静态
                                #else
                                动态
                                #end
                            </td>

                            <td>#date(entry.created)</td>
                            <td>#date(entry.modified)</td>
                        </tr>
                        #end
                        </tbody>
                    </table>
                </div>
                <!-- /.card-body -->
                <div class="card-footer">
                    <div class="row">

                        <div class="col-sm-6">
                            <div class="row">

                                <div class="form-group">
                                    <div class="form-check">
                                        <input class="form-check-input tableCheckAll" id="checkall" type="checkbox">
                                        <label class="form-check-label" for="checkall">全选</label>
                                    </div>
                                </div>
                                <div class="form-group col-lg-3">
                                    <select class="form-control" name="action">
                                        <option value="">请选择...</option>
                                        <option value="doDelByIds" open-type="del-confirm">
                                            批量删除
                                        </option>
                                    </select>
                                </div>

                                <div class="form-group col-lg-3">
                                    <button type="button" class="btn btn-outline-primary batchExec">批量操作</button>
                                </div>
                            </div>

                        </div>

                        <div class="col-sm-6">
                            #@_paginate()
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.box -->
        </div>
    </div>

</section>
#end
